import request from '@/utils/request'
/**错误提示显示时间 */
const errorDuration = 10000


/**扫码取消序列号 */
export function cancelSer(data) {
  return request({
    url: '/distribution/batch/cancelSer',
    method: 'post',
    data,

  })
}

/**查询批次未完成箱子列表 */
export function queryListByStatus(batchId) {
  return request({
    url: `/distribution/batch/queryListByStatus?batchId=${batchId}`,
  })
}

/**换箱操作 */
export function exchangeBox(data) {
  return request({
    url: `/distribution/batch/exchangeBox`,
    method: 'post',
    data
  })
}




/**删除批次 */
export function deleteBatchById(batchId) {
  return request({
    url: '/distribution/batch/deleteBatchById/' + batchId,
    method: 'DELETE',
  })
}

/**查询批次物流详情 */
export function getBatchExpressListById(params) {
  return request({
    url: '/distribution/batch/getBatchExpressListById',
    params,
  })
}


/**头程修改信息 */
export function updateHeadPath2(data) {
  return request({
    url: '/distribution/batch/updateHeadPath2',
    method: 'POST',
    data,
  })
}
/**头程确认收货 */
export function updateHeadPath1(data) {
  return request({
    url: '/distribution/batch/updateHeadPath1',
    method: 'POST',
    data,
  })
}


/**中程修改信息 */
export function updateCentrePath2(data) {
  return request({
    url: '/distribution/batch/updateCentrePath2',
    method: 'POST',
    data,
  })
}
/**中程确认收货 */
export function updateCentrePath1(data) {
  return request({
    url: '/distribution/batch/updateCentrePath1',
    method: 'POST',
    data,
  })
}


/**尾程修改信息 */
export function updateTailPath2(data) {
  return request({
    url: '/distribution/batch/updateTailPath2',
    method: 'POST',
    data,
  })
}
/**尾程确认收货 */
export function updateTailPath1(data) {
  return request({
    url: '/distribution/batch/updateTailPath1',
    method: 'POST',
    data,
  })
}






/**询快递公司列表-不分页 */
export function expressCompanyListNoPage(params) {
  return request({
    url: '/distribution/expressCompany/listNoPage',
    params,
  })
}


/**删除箱子 */
export function deleteBox(boxId) {
  return request({
    url: 'distribution/batch/deleteBox/' + boxId,
    method: 'delete',
  })
}


/**互换箱号 */
export function convertBoxNo(data) {
  return request({
    url: 'distribution/batch/convertBoxNo',
    method: 'post',
    data
  })
}


// 查询批次列表
export function listBatch(query) {
  return request({
    url: '/distribution/batch/list',
    params: query,
    headers: {
      errorDuration
    },
  })
}

// 查询批次详细
export function getBatch(id) {
  return request({
    url: '/distribution/batch/' + id,
    headers: {
      errorDuration
    },
  })
}

// 新增批次
export function addBatch(data) {
  return request({
    url: '/distribution/batch',
    method: 'post',
    data: data,
    headers: {
      errorDuration
    },
  })
}

/**修改批次 */
export function updateBatch(data) {
  return request({
    url: '/distribution/batch/updateBatch',
    method: 'post',
    data: data,
    headers: {
      errorDuration
    },
  })
}

// 删除批次
export function delBatch(id) {
  return request({
    url: '/distribution/batch/' + id,
    method: 'delete',
    headers: {
      errorDuration
    },
  })
}

// 查询箱子SKU列表
export function getBatchBoxSkuListByBatchId(params) {
  return request({
    url: '/distribution/batch/getBatchBoxSkuListByBatchId',
    params,
    headers: {
      errorDuration
    },
  })
}

// 创建批次
export function createBatch(params) {
  return request({
    url: '/distribution/batch/createBatch',
    params,
    headers: {
      errorDuration
    },
  })
}

// 追加箱子
export function appendBox(data) {
  return request({
    url: '/distribution/batch/appendBox',
    method: 'post',
    data,
    headers: {
      errorDuration
    },
  })
}

// 追加箱子查询详情
export function getBatchDetails(params) {
  return request({
    url: '/distribution/batch/getBatchDetails',
    params,
    headers: {
      errorDuration
    },
  })
}

// 批次出运
export function completeTransportation(params) {
  return request({
    url: '/distribution/batch/completeTransportation',
    params,
    headers: {
      errorDuration
    },
  })
}

// 完成箱子
export function completeBatchBox(params) {
  return request({
    url: '/distribution/batch/completeBatchBox',
    params,
    headers: {
      errorDuration
    },
  })
}
// 删除箱子里面的SKU
export function deleteBatchBoxSku(params) {
  return request({
    url: `/distribution/batch/deleteBoxSku/${params.id}`,
    method: 'delete',
    headers: {
      errorDuration
    },
  })
}

// 删除箱子
export function deleteBatchBox(params) {
  return request({
    url: '/distribution/batch/deleteBatchBox',
    method: 'delete',
    params,
    headers: {
      errorDuration
    },
  })
}
// 查询批次箱子列表
export function getBoxSkuList(params) {
  return request({
    url: '/distribution/batch/getBoxSkuList',
    params,
    headers: {
      errorDuration
    },
  })
}

// 设置箱子真实重量
export function updateBoxTruthWeight(params) {
  return request({
    url: '/distribution/batch/updateBoxTruthWeight',
    params,
    headers: {
      errorDuration
    },
  })
}

// 设置箱子真实重量
export function getBatchBoxSkuSerializableList(params) {
  return request({
    url: '/distribution/batch/getBatchBoxSkuSerializableList',
    params,
    headers: {
      errorDuration
    },
  })
}

/**扫码装箱 */
export function scanQrCode(data) {
  return request({
    url: '/distribution/batch/scanQrCode',
    method: 'post',
    data,
    headers: {
      errorDuration
    },
  })
}


// 删除箱子里面的SKU
export function deleteBoxSkuSerializable(params) {
  return request({
    url: `/distribution/batch/deleteBoxSkuSerializable/${params.skuSerializableId}`,
    method: 'delete',
    headers: {
      errorDuration
    },
  })
}



/**装箱列表获取耗材明细 */
export function getBatchSkuConsumableRecords(params) {
  return request({
    url: '/distribution/skuConsumable/getBatchSkuConsumableRecords',
    params,
    headers: {
      errorDuration
    },
  })
}




/**根据耗材ID查询耗材使用记录 */
export function getConsumableRecordsByCesId(params) {
  return request({
    url: '/distribution/skuConsumable/getConsumableRecordsByCesId',
    params,
  })
}
